<?php /*a:3:{s:57:"D:\projects\junhe\app\index\view\article\list_select.html";i:1742662512;s:51:"D:\projects\junhe\app\index\view\common\header.html";i:1740139655;s:51:"D:\projects\junhe\app\index\view\common\footer.html";i:1740136709;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no,mail=yes">

	<title><?php if(isset($article['title'])): ?><?php echo htmlentities($article['title'],ENT_QUOTES); ?> - <?php endif; if(isset($catInfo['title'])): ?><?php echo htmlentities($catInfo['title'],ENT_QUOTES); ?> -
		<?php endif; ?><?php echo htmlentities($config['name'],ENT_QUOTES); ?></title>
	<meta name="keywords"
		content="<?php if(isset($article['keywords'])): ?><?php echo htmlentities($article['keywords'],ENT_QUOTES); elseif(isset($catInfo['keywords'])): ?><?php echo htmlentities($catInfo['keywords'],ENT_QUOTES); else: ?><?php echo htmlentities($config['keyword'],ENT_QUOTES); ?><?php endif; ?>">
	<meta name="description"
		content="<?php if(isset($article['subtitle'])): ?><?php echo htmlentities($article['subtitle'],ENT_QUOTES); elseif(isset($catInfo['desc_text'])): ?><?php echo htmlentities($catInfo['desc_text'],ENT_QUOTES); else: ?><?php echo htmlentities($config['content'],ENT_QUOTES); ?><?php endif; ?>">
	<link rel="shortcut icon" href="<?php echo htmlentities($config['site_icon'],ENT_QUOTES); ?>" type="image/x-icon">
	<script src="/public/home/js/jquery-1.8.3.min.js"></script>
	<link rel="stylesheet" href="/public/home/layui/css/layui.css">
	<link rel="stylesheet" href="/public/home/css/common.css">
	<link rel="stylesheet" href="/public/home/css/hover.css">
	<link rel="stylesheet" href="/public/home/css/index.css">
	<script type="text/javascript" src="/public/home/layui/layui.js"></script>
	<link rel="stylesheet" href="/public/home/css/swiper-bundle.css" />
	<script src="/public/home/js/scrollReveal.js" type="text/javascript"></script>

</head>

<body>
	<header class="header w100">
	
			<div class="layui-main d-flex al-c jc-s">
			
					<div class="d-flex al-c">
						<a href="/" class="logo img_100 mr20 d-fs">
							<img class="" src="<?php echo htmlentities($config['pic'],ENT_QUOTES); ?>">
						</a>
					</div>

					<ul class="d-flex  jc-se al-c layui-nav layui-hide-xs ">
						<li
							class="layui-nav-item <?php if((isset($catTreeList['topCate']['id']) && empty($catTreeList['topCate']['id'])) || !isset($catTreeList['topCate']['id'])): ?>layui-this <?php endif; ?>">
							<a href="/"><?php echo htmlentities($function->getCatInfo('1')['title'],ENT_QUOTES); ?></a>
						</li>

						<?php if(is_array($nav) || $nav instanceof \think\Collection || $nav instanceof \think\Paginator): if( count($nav)==0 ) : echo "" ;else: foreach($nav as $key=>$navValue): ?>
							<li
								class="layui-nav-item <?php if((isset($catTreeList['topCate']['id']) && $catTreeList['topCate']['id'] == $navValue['id'])): ?>layui-this <?php endif; ?> ">
								<a href="<?php echo htmlentities($navValue['url'],ENT_QUOTES); ?>" > <?php echo htmlentities($navValue['title'],ENT_QUOTES); ?></a>
							</li>
						<?php endforeach; endif; else: echo "" ;endif; ?>

					</ul>
					<div class="layui-hide layui-show-xs-block  ">
						<i lay-on="nav" class="layui-icon layui-icon-spread-left "></i>
					</div>
				
				<div class="d-flex gap20 al-c">
				    <?php if($is_login): ?>
					<a href="/index/member/" class="img_box d-fs">
				        <img src="/public/home/images/user-account.png">
				    </a>
					<?php else: ?> 
					<a href="/login" class="layui-btn br25 login-btn d-fs">登录/注册</a>
					<?php endif; ?>
                    
                    <form action="/index/article/search/">
                        <input name="keyword" value=" <?php if(isset($keyword)): ?><?php echo htmlentities($keyword,ENT_QUOTES); ?><?php endif; ?>" placeholder="输入关键词搜索">
                        <input name="model" value="产品" type="hidden">
                        <button>
                            <img src="/public/home/images/search.png">
                        </button>
                    </form>
				</div>
				
			</div>
	</header>

	<script>
  layui.use(function(){
    var layer = layui.layer;
 
    	
    		var util = layui.util;
			util.on({
				nav: function () {
					layer.open({
						type: 1,
						offset: 'l',
						anim: 'slideRight', // 从左往右
						area: ['200px', '100%'],
						shade: 0.1,
						title: false,
						shadeClose: true,
						closeBtn: 0,
						id: 'ID-demo-layer-direction-l',
						content: `
                <ul class="gary_c3 d-grid gap30  pt40 pb40">
                
                	<li class="pl20 pr20 <?php if((isset($catTreeList['topCate']['id']) && empty($catTreeList['topCate']['id'])) || !isset($catTreeList['topCate']['id'])): ?>layui-this <?php endif; ?>">
							<a href="/"><?php echo htmlentities($function->getCatInfo('1')['title'],ENT_QUOTES); ?></a>
						</li>
						<?php if(is_array($nav) || $nav instanceof \think\Collection || $nav instanceof \think\Paginator): if( count($nav)==0 ) : echo "" ;else: foreach($nav as $key=>$navValue): ?>
            			<li
            				class="pl20 pr20 <?php if((isset($catTreeList['topCate']['id']) && $catTreeList['topCate']['id'] == $navValue['id'])): ?>layui-this <?php endif; ?> ">
            				<a <?php if(!$navValue['childList']): ?>href="<?php echo htmlentities($navValue['url'],ENT_QUOTES); ?>" <?php endif; ?>> <?php echo htmlentities($navValue['title'],ENT_QUOTES); ?></a>
            			</li>
            		<?php endforeach; endif; else: echo "" ;endif; ?>
            		</ul>
						
                `
					});
				},
			});
    	
  });

	</script>

<!-- 中间区域 -->
<script src="/public/static/xm-select.js" type="text/javascript"></script>
<main>

    <section>

        <div class="layui-main">

            <form class="order-select-form layui-form" onsubmit="return false">

                <ul class="layui-row layui-col-space24 ul_height ">

                    <li class="layui-col-md6 layui-col-xs12">

                        <div class="item"><span>产品类别:</span>

                            <div class="block">

                                <select name="goods_cate_1" lay-filter="category_select">

                                        <option value="">请选择产品类型 </option>

                                    <?php if(is_array($goods_cate) || $goods_cate instanceof \think\Collection || $goods_cate instanceof \think\Paginator): $i = 0; $__LIST__ = $goods_cate;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cat): $mod = ($i % 2 );++$i;?> 

                                         <option  value="<?php echo htmlentities($cat['id'],ENT_QUOTES); ?>"  <?php if(isset($goods_cate_1) && $goods_cate_1 == $cat['id']): ?> selected <?php endif; ?> ><?php echo htmlentities($cat['title'],ENT_QUOTES); ?></option>

                                    <?php endforeach; endif; else: echo "" ;endif; ?>

                                   

                                </select>

                            </div>

                        </div>

                    </li>

                    <li class="layui-col-md6 layui-col-xs12">
                            
                    </li>
                   
                    <li class="layui-col-md6 layui-col-xs12">

                        <div class="item"><span>产品分类:</span>

                            <div class="block">

                                <select name="goods_cate_2" id="goods_cate_2" lay-filter="category_select_2">
                                    <option value="">请选择产品分类</option>
                                    <?php if(isset($goods_cate_2_list) && count($goods_cate_2_list)): if(is_array($goods_cate_2_list) || $goods_cate_2_list instanceof \think\Collection || $goods_cate_2_list instanceof \think\Paginator): $i = 0; $__LIST__ = $goods_cate_2_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cate): $mod = ($i % 2 );++$i;?> 

                                            <option value="<?php echo htmlentities($cate['id'],ENT_QUOTES); ?>" <?php if(isset($goods_cate_2) && $goods_cate_2 == $cate['id']): ?> selected <?php endif; ?>><?php echo htmlentities($cate['title'],ENT_QUOTES); ?></option>

                                        <?php endforeach; endif; else: echo "" ;endif; ?>
                                    <?php endif; ?>
                                    
                                </select>

                            </div>

                        </div>

                    </li>
                    <li class="layui-col-md6 layui-col-xs12">

                        <div class="item"><span>产品分类:</span>

                            <div class="block">

                                <select name="goods_cate_3" id="goods_cate_3" lay-filter="category_select_3">
                                    <option value="">请选择产品分类</option>
                                    <?php if(isset($goods_cate_3_list) && count($goods_cate_3_list)): if(is_array($goods_cate_3_list) || $goods_cate_3_list instanceof \think\Collection || $goods_cate_3_list instanceof \think\Paginator): $i = 0; $__LIST__ = $goods_cate_3_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cate): $mod = ($i % 2 );++$i;?> 

                                            <option value="<?php echo htmlentities($cate['id'],ENT_QUOTES); ?>" <?php if(isset($goods_cate_3) && $goods_cate_3 == $cate['id']): ?> selected <?php endif; ?>><?php echo htmlentities($cate['title'],ENT_QUOTES); ?></option>

                                        <?php endforeach; endif; else: echo "" ;endif; ?>
                                    <?php endif; ?>
                                </select>

                            </div>

                        </div>

                    </li>
                
                    <?php if(isset($spec_list)): if(is_array($spec_list) || $spec_list instanceof \think\Collection || $spec_list instanceof \think\Paginator): $i = 0; $__LIST__ = $spec_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$spec): $mod = ($i % 2 );++$i;if($spec['type'] == 'input'): ?> 

                            <li class="layui-col-md4 layui-col-xs12 apecs_item">

                                <div class="item"><span><?php echo htmlentities($spec['name'],ENT_QUOTES); ?>:</span>

                                    <div class="block">

                                        <input type="text" class="layui-input" name="<?php echo htmlentities($spec['id'],ENT_QUOTES); ?>" placeholder="请输入<?php echo htmlentities($spec['name'],ENT_QUOTES); ?>" value="<?php echo htmlentities((isset($product_select[$spec['id']]) && ($product_select[$spec['id']] !== '')?$product_select[$spec['id']]:''),ENT_QUOTES); ?>">

                                    </div>

                                </div>

                            </li>

                        <?php endif; if($spec['type'] == 'select'): ?> 

                            <li class="layui-col-md4 layui-col-xs12 apecs_item">

                                <div class="item"><span><?php echo htmlentities($spec['name'],ENT_QUOTES); ?>:</span>

                                    <div class="block">

                                        <select name="<?php echo htmlentities($spec['id'],ENT_QUOTES); ?>">

                                            <?php if(count($spec['values'])): ?> 

                                                    <option value="">请选择<?php echo htmlentities($spec['name'],ENT_QUOTES); ?></option>

                                                <?php if(is_array($spec['values']) || $spec['values'] instanceof \think\Collection || $spec['values'] instanceof \think\Paginator): $i = 0; $__LIST__ = $spec['values'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$values): $mod = ($i % 2 );++$i;?> 

                                                    <option value="<?php echo htmlentities($values['id'],ENT_QUOTES); ?>" <?php if(isset($product_select[$spec['id']]) && $product_select[$spec['id']] == $values['id']): ?> selected <?php endif; ?>><?php echo htmlentities($values['value'],ENT_QUOTES); ?></option>

                                                <?php endforeach; endif; else: echo "" ;endif; ?> 

                                            <?php endif; ?>

                                    

                                        </select>

                                    </div>

                                </div>

                            </li>

                        <?php endif; if($spec['type'] == 'checkbox'): ?>
                            
                            <li class="layui-col-md4 layui-col-xs12 apecs_item">
                                <div class="item">
                                    <span><?php echo htmlentities($spec['name'],ENT_QUOTES); ?>:</span>
                                    <div class="block" id="checkbox<?php echo htmlentities($spec['id'],ENT_QUOTES); ?>">
                                      
                                    </div>
                                    <script>
                                        // 动态生成 xmSelect 的数据
                                        var data = [
                                          // 遍历规格值，生成选项
                                          <?php if(is_array($spec['values']) || $spec['values'] instanceof \think\Collection || $spec['values'] instanceof \think\Paginator): $i = 0; $__LIST__ = $spec['values'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$values): $mod = ($i % 2 );++$i;?>
                                          {
                                            name: '<?php echo htmlentities($values['value'],ENT_QUOTES); ?>', // 显示的名称
                                            value: '<?php echo htmlentities($values['id'],ENT_QUOTES); ?>',  // 对应的值
                                            selected: <?php if(isset($product_select[$spec['id']]) && in_array($values['id'], explode(',', $product_select[$spec['id']]))): ?> true <?php else: ?> false <?php endif; ?>, // 是否默认选中
                                          },
                                          <?php endforeach; endif; else: echo "" ;endif; ?>
                                        ];
                                    
                                        // 初始化 xmSelect
                                        xmSelect.render({
                                          el: '#checkbox<?php echo htmlentities($spec['id'],ENT_QUOTES); ?>', // 绑定容器
                                          name: '<?php echo htmlentities($spec['id'],ENT_QUOTES); ?>',
                                          data: data, // 动态生成的数据
                                          toolbar: {
                                                show: true, // 隐藏工具栏（包括全选按钮）
                                            },
                                          filterable: true,
                                           theme: {
                                            color: '#404D5A', // 主题颜色
                                          },
                                        });
                                      </script>
                                </div>
                            </li>
                        <?php endif; ?>

                    <?php endforeach; endif; else: echo "" ;endif; ?>

                    <?php endif; ?>

                </ul>



                <div class="flex-center mt40 gap30 gap10-xs">

                    <a href="/site-List-5" type="reset" class="layui-btn">重置选项</a>

                    <button class="layui-btn" lay-submit lay-filter="search_goods">立即查询</button>

                </div>

            </form>



            <div class="mt26 select_list_total">

                <div class="d-flex al-c gap20 layui-form">

                    <span>排序</span>

                    <select>

                        <option>默认</option>

                    </select>

                </div>

                <span class="ft20">搜索到<?php echo htmlentities((isset($goods_model_count) && ($goods_model_count !== '')?$goods_model_count:0),ENT_QUOTES); ?>条</span>

                <div class="pagenum2">

                    <div id="demo-laypage-normal-2"></div>

                </div>

            </div>





            <ul class="select-product mt30">

                <?php if(isset($goods_models) &&  count($goods_models)): if(is_array($goods_models) || $goods_models instanceof \think\Collection || $goods_models instanceof \think\Paginator): $i = 0; $__LIST__ = $goods_models;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$models): $mod = ($i % 2 );++$i;?> 

                        <li data-modelid="<?php echo htmlentities($models['id'],ENT_QUOTES); ?>" data-goodsid="<?php echo htmlentities($models['goods_id'],ENT_QUOTES); ?>">

                            <div>

                                <i class="check-img"></i>

                            </div>

                            <div class="info">

                                <div class="img_100">

                                    <img src="<?php echo htmlentities($models['thumb'],ENT_QUOTES); ?>">

                                </div>

                                <div style="text-align: center;"><?php echo !empty($models['goods']) ? htmlentities($models['goods']['title'],ENT_QUOTES) : ''; ?></div>

                                <div style="text-align: center;"><?php echo htmlentities($models['name'],ENT_QUOTES); ?></div>

                                <div class="num-box" data-type="number">

                                <i lay-on="sub" class="layui-icon layui-icon-subtraction"></i>

                            <input data-name="number" class="layui-input cart_num"  value="1">

                                <i lay-on="add" class="layui-icon layui-icon-addition"></i>

                            </div>

                            <a class="layui-btn layui-btn-primy add_cart" data-modelid="<?php echo htmlentities($models['id'],ENT_QUOTES); ?>" data-goodsid="<?php echo htmlentities($models['goods_id'],ENT_QUOTES); ?>">加入购物车</a>

                            <a href="/goods-detail-<?php echo htmlentities($models['goods_id'],ENT_QUOTES); ?>" class="layui-btn layui-btn-primy">查看详情</a>

                            </div>

                            <dl>

                                <?php if(count($models['attributes_info'])): if(is_array($models['attributes_info']) || $models['attributes_info'] instanceof \think\Collection || $models['attributes_info'] instanceof \think\Paginator): $i = 0; $__LIST__ = $models['attributes_info'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$attribute): $mod = ($i % 2 );++$i;?> 

                                        <dd>

                                            <p><?php echo htmlentities($attribute['name'],ENT_QUOTES); ?>：</p>

                                            <p><?php echo htmlentities($attribute['value'],ENT_QUOTES); ?></p>

                                        </dd>

                                    <?php endforeach; endif; else: echo "" ;endif; ?>

                                <?php endif; ?>

                            </dl>

                        </li>

                    <?php endforeach; endif; else: echo "" ;endif; ?>

                <?php endif; ?>

                    

            </ul>



            <div class="pagenum1">



                <div id="demo-laypage-normal-1"></div>

            </div>

        </div>

    </section>

</main>

<div class="order-confrim">

    <div class="layui-main d-flex al-c jc-s">

        <div>购物车已选择<span data-count="all"> 0</span> 件产品</div>

        <button class="layui-btn red-btn sure_order">立即下单</button>

    </div>

</div>

<script src="/public/home/js/index.js"></script>

<script src="/public/static/index.js"></script>



<script>

    layui.use(function () {

        var laypage = layui.laypage;

        // 普通用法

        laypage.render({

            elem: 'demo-laypage-normal-1',

            count: 50, 

            limit: 6,

            curr : <?php echo htmlentities((isset($goods_model_page) && ($goods_model_page !== '')?$goods_model_page:0),ENT_QUOTES); ?>,

            count: <?php echo htmlentities((isset($goods_model_count) && ($goods_model_count !== '')?$goods_model_count:0),ENT_QUOTES); ?>,

            jump: function(obj, first){

                // obj 包含了当前分页的所有参数

                let page = obj.curr;



                // 获取当前 URL 和查询参数

                let url = new URL(location.href);

                let params = new URLSearchParams(url.search);



                // 设置或更新 page 参数

                params.set('page', page);



                // 将更新后的参数应用到 URL

                url.search = params.toString();



                // 首次不执行

                if (!first) {

                     // 跳转到新的 URL

                    location.href = url.toString();

                }

            }

        });



        laypage.render({

            elem: 'demo-laypage-normal-2',

            count: 10,

            first: '首页',

            last: '尾页',

            prev: false,

            next: false,

            limit: 10,

            curr : <?php echo htmlentities((isset($goods_model_page) && ($goods_model_page !== '')?$goods_model_page:0),ENT_QUOTES); ?>,

            count: <?php echo htmlentities((isset($goods_model_count) && ($goods_model_count !== '')?$goods_model_count:0),ENT_QUOTES); ?>,

            jump: function(obj, first){

                // obj 包含了当前分页的所有参数

                let page = obj.curr;



                // 获取当前 URL 和查询参数

                let url = new URL(location.href);

                let params = new URLSearchParams(url.search);



                // 设置或更新 page 参数

                params.set('page', page);



                // 将更新后的参数应用到 URL

                url.search = params.toString();



                // 首次不执行

                if (!first) {

                     // 跳转到新的 URL

                    location.href = url.toString();

                }

            }

        });

    });



  



</script>



<script>

    $(document).on('click', '.select-box dd', function () {

        $(this).toggleClass('active');

        var arr = [];

        $(this).closest('dl').find('.active').each(function () {

            arr.push($(this).find('span').text())

        })

        console.log(arr)

        $(this).closest('.select-auto-box').children('input').val(arr.join('、'))

    })

    

    $(document).on('click', '.check-img', function () {

        $(this).closest('li').toggleClass('active')

        $('[data-count="all"]').text($('.select-product li.active').length)

    })

    layui.use('form', function(){

        var form = layui.form;

        form.on('select(category_select)', function (data) {
            var categoryId = data.value;
            if (!categoryId) return;
           $('.apecs_item').remove();
            // 请求二级分类数据
            ajaxRequest('/get-second-category', { parent_id: categoryId }, 'POST', this, function (response) {
                var secondSelect = document.querySelector('select[name="goods_cate_2"]');
                secondSelect.innerHTML = '<option value="">请选择产品分类</option>';
                if(response.data.length){
                    response.data.forEach(function (item) {
                        secondSelect.innerHTML += `<option value="${item.id}">${item.title}</option>`;
                    });
                    form.render('select');
                }
                
            });
        });
         // 监听二级分类选择
        form.on('select(category_select_2)', function (data) {
            var categoryId = data.value;
            if (!categoryId) return;
            $('.apecs_item').remove();
            // 请求三级分类数据
            ajaxRequest('/get-second-category', { parent_id: categoryId }, 'POST', this, function (response) {
                var thirdSelect = document.querySelector('select[name="goods_cate_3"]');
                thirdSelect.innerHTML = '<option value="">请选择产品分类</option>';
                response.data.forEach(function (item) {
                    thirdSelect.innerHTML += `<option value="${item.id}">${item.title}</option>`;
                });
                form.render('select');
            });
        });
        form.on('select(category_select_3)', function(data){
            var thirdCategoryId = data.value;
            let url = data.value
            var firstCategoryId = document.querySelector('select[name="goods_cate_1"]').value;
            var secondCategoryId = document.querySelector('select[name="goods_cate_2"]').value;
            if (url) {
                window.location.href = "/site-List-5.html?goods_cate_1=" + firstCategoryId + "&goods_cate_2=" + secondCategoryId + "&goods_cate_3=" + thirdCategoryId;

            }

         }); 

        //监听提交

        form.on('submit(search_goods)', function(data){

            var formData = data.field;

            formData.spec = 1;

            // 将表单数据转换为URL参数字符串，过滤掉空值

            var queryString = Object.keys(formData)

                .filter(function(key) {

                    // 过滤掉空值（包括空字符串、null、undefined）

                    return formData[key] !== '' && formData[key] != null;

                })

                .map(function(key) {

                    // 对键和值进行编码

                    return encodeURIComponent(key) + '=' + encodeURIComponent(formData[key]);

                })

                .join('&');



            // 获取当前页面的URL（不包含参数）

            var currentUrl = window.location.href.split('?')[0];



            // 如果有参数，附加到当前URL上

            var newUrl = currentUrl + (queryString ? '?' + queryString : '');



            // 跳转到新的URL（发起GET请求）

            window.location.href = newUrl;



            return false; // 阻止表单默认提交

        });

    });



    $(document).on('click', '.search_goods', function() {

        // 创建一个对象来存储用户选择的数据

        var formData = {};

        

        // 获取表单中所有的输入项

        $('form.order-select-form').find('select, input').each(function() {

            var name = $(this).attr('name'); // 获取属性名称

            var value = $(this).val(); // 获取属性值

            

            if (value) {  // 如果有选择值

                formData[name] = value;

            }

        });



        // 提交表单数据

        $.ajax({

            url: '/search-products', // 后端处理搜索的接口

            type: 'POST',

            data: formData,

            success: function(response) {

                if (response.code === 1) {

                    // 成功后，渲染产品列表

                    renderProducts(response.data);

                } else {

                    layer.msg(response.msg || '搜索失败', { icon: 2 });

                }

            }

        });

    });



    $(document).on('click', '.add_cart', function () {

        let goods_id = $(this).data('goodsid');

        let model_id = $(this).data('modelid');



        let cart_num = $(this).closest('.info').find('.cart_num').val(); // 修正这里的查找方式



        let field = {

            goods_id: goods_id,

            model_id: model_id,

            cart_num: cart_num

        };







        ajaxRequest('/goods-cart-add', field, 'POST', this, function (response) {

            layer.msg('添加成功', {icon: 1, time: 2000}, function () {});

        });

    });





    $(document).on('click', '.sure_order', function () {

        let selectedItems = [];



        // 筛选所有已选中的商品（带 .active 类的 li）

        $('li.active').each(function () {

            let goods_id = $(this).data('goodsid'); // 获取商品ID

            let model_id = $(this).data('modelid'); // 获取型号ID

            let cart_num = $(this).find('.cart_num').val(); // 获取数量



            if (goods_id && model_id && cart_num > 0) {

                selectedItems.push({

                    goods_id: goods_id,

                    model_id: model_id,

                    cart_num: cart_num

                });

            }

        });



        if (selectedItems.length === 0) {

            layer.msg('请选择商品后再下单', { icon: 2 });

            return;

        }



        // 发送 AJAX 请求

        ajaxRequest('/submit-order-batch', { items: selectedItems }, 'POST', this, function (response) {

            layer.msg('下单成功', { icon: 1, time: 2000 }, function () {

                window.location.href = '/index/member/';

            });

        });

    });



    

</script>

<!-- 中间区域结束 -->


<footer class="pt36 pb36 ">

      <div class="layui-main d-grid gap20 al-c white_c" >
         <a href="/" class="img_box  mb10">
            <img src="<?php echo htmlentities($config['footer_pic'],ENT_QUOTES); ?>">
         </a>
       
            <ul class="d-flex  jc-c al-c gap84 gap20-xs flex-wrap">
        
               <?php if(is_array($nav) || $nav instanceof \think\Collection || $nav instanceof \think\Paginator): if( count($nav)==0 ) : echo "" ;else: foreach($nav as $key=>$navValue): ?>

               <li lay-unselect>
                  <a href="<?php echo htmlentities($navValue['url'],ENT_QUOTES); ?>"> <?php echo htmlentities($navValue['title'],ENT_QUOTES); ?></a>
               </li>
               <?php endforeach; endif; else: echo "" ;endif; ?>

            </ul>

         <ul class="d-flex al-c jc-se flex-wrap">
            <li >
               <div class="item">
              <img class="d-fs" src="/public/home/images/tel.png">    联系电话：<span> <?php echo htmlentities($config['tel'],ENT_QUOTES); ?></span>
               </div>
            </li>
            <li >
               <div class="item">
                 <img class="d-fs" src="/public/home/images/email.png">  <span class="white-nowrap"> 邮箱：</span> <span><?php echo htmlentities($config['email'],ENT_QUOTES); ?></span>
               </div>
            </li>
            <li >
               <div class="item">
                 <img class="d-fs" src="/public/home/images/address.png"> <span class="white-nowrap"> 地址：</span> <span><?php echo htmlentities($config['address'],ENT_QUOTES); ?></span>
               </div>
            </li>

         </ul>
         <p class="ft14 text-align-center"><?php echo htmlentities($config['copy'],ENT_QUOTES); ?></p>
      </div>
</footer>
</body>

</html>